<?php
//include_once libfile('function/misc');
if($_GET['action']=="call"){
	if(!empty($_GET['str'])){
		$out="";
		$tagres=C::t("user_user")->fecth_like_username($_GET['str'],10);
		foreach ($tagres as $v){
			$out+="<li><a>".$v."</a></li>";
		}
		echo $out;
	}
}elseif($_GET['action']=="tag"){
	if(!empty($_GET['str'])){
		$out="";
		$tagres=C::t("common_tag")->fecth_like_tagname($_GET['str'],10);
		foreach ($tagres as $v){
			$out+="<li><a>".$v."</a></li>";
		}
		echo $out;
	}
}elseif($_GET['action']=='smiley'){
	if(!empty($_GET['smileid'])){
		$ret=array();
		$tmp=array();
		$smileid=intval($_GET['smileid']);
		foreach($_G['cache']['smiley']['typearray'] as $key=>$val){//smileid=>smiletype
			if($val==$smileid){
				$tmp['smilename']=$_G['cache']['smiley']['searcharray'][$key];
				$tmp['smileurl']=$_G['cache']['smiley']['replacearray'][$key];
				$ret[]=$tmp;
			}else{
				continue;
			}
		}
		echo json_encode($ret);
	}
}elseif($_GET['action']=='checkvideo'){
	if($_GET['url']){
		include_once libfile('function/bbcode');
		$ret=parseflv($_GET['url']);
		if(!is_array($ret)){
			$ret=array('status'=>'-1');
		}else{
			$ret['status']='1';
		}
		echo json_encode($ret);
	}
}elseif($_GET['action']=='getvideo'){
	if($_GET['url']){
		include_once libfile('function/bbcode');
		echo parseflv($_GET['url'],'400','300');
	}
}elseif($_GET['action']=='upload'){
	if(!empty($_FILES['file'])){
		$upload=new common_upload();
		$upload->init($_FILES['file'],'square');
	}
	
}
?>